package edu.software.PBL_Management_System.util;


import edu.software.PBL_Management_System.entity.User;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class DemandUtil {
    //本质是是UserService
    @Resource
    private DemandRepositoryUtil demandRepositoryUtil;

    public User getUserById(Long id) {
        return demandRepositoryUtil.findById(id)
                .orElseThrow(() -> new RuntimeException("User not found"));
    }

    public User updateUser(User user) {
        return demandRepositoryUtil.save(user);
    }
}
